# Contributor: Daniel Sabogal <dsabogalcc@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=discount
pkgver=2.2.6
pkgrel=0
pkgdesc="A Markdown to HTML translator written in C"
url="http://www.pell.portland.or.us/~orc/Code/discount/"
arch="all"
license="BSD-3-Clause"
depends="!markdown"
checkdepends="diffutils"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/Orc/discount/archive/v$pkgver.tar.gz
	configure.inc.patch
	"

build() {
	./configure.sh \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--enable-all-features \
		--with-fenced-code \
		--pkg-config \
		--shared
	make -j1
}

check() {
	msg "Running testsuites..."
	make test
}

package() {
	make PREFIX=/usr DESTDIR="$pkgdir" install.everything
	local bin; for bin in theme makepage mkd2html; do
		mv "$pkgdir"/usr/bin/$bin \
			"$pkgdir"/usr/bin/$pkgname-$bin
		mv "$pkgdir"/usr/share/man/man1/$bin.1 \
			"$pkgdir"/usr/share/man/man1/$pkgname-$bin.1
	done
}

sha512sums="4c5956dea78aacd3a105ddac13f1671d811a5b2b04990cdf8485c36190c8872c4b1b9432a7236f669c34b07564ecd0096632dced54d67de9eaf4f23641417ecc  discount-2.2.6.tar.gz
6935a52d3fa1ee70e21cf6290bd83e045e8da349ef48ab7241c4eb075caded11945c9d1eabc7e9cdf549a4101daf81e10675464b84876838da669d2086f1de43  configure.inc.patch"
